<form id="<?php echo $uniqid;?>" method="post" style="padding: 0 0 10px 0;">
    <table border="0" width="100%" cellspacing="1" cellpadding="0" class="formtable">
        <tr>
            <td>
                <div style="display: flex; justify-content: space-between; align-items: center;">
                    <p style="flex: 1;">订单号：{{ params.order_sn }}<span v-if="params.is_first==1" style="color: #ff6060">(首.单)</span></p>
                    <p style="flex: 1;">下单时间：{{ params.created_at }}</p>
                    <p style="flex: 1;">订单来源：{{ params.platform | platform }}</p>
                </div>
            </td>
        </tr>
        <tr>
            <td>
                <div style="display: flex; justify-content: space-around; align-items: center;">
                    <div style="flex:5;">
                        <div style="font-size: 22px; font-weight: bolder;">{{ params.status_name }}</div>
                        <p class="order-status-tip color-333">{{ params.status_desc }}</p>

                        <div class="display-flex ">
                            <div class="common-btn order-main-btn" @click="openDeliverDialog()"
                                 v-if="params.abtns && params.abtns.indexOf('send')!=-1">立即发货
                            </div>
                            <div class="immediately-choice-text" @click="openSendStoreDialog()"
                                 v-if="params.abtns && params.abtns.indexOf('send_store')!=-1">立即备货
                            </div>
                            <div class="all-refund-money-text" @click="openRefundDialog(params,null)"
                                 v-if="params.abtns && params.abtns.indexOf('refund')!=-1">全部退款
                            </div>
                        </div>

                        <p style="line-height: 28px" v-if="params.memo">商家备注: {{ params.memo }}</p>
                        <p><a href="#" @click="addMemo">添加商家备注</a></p>
                    </div>
                    <div style="flex:3">
                        <p style="line-height: 28px">商品总价: ￥{{ params.goods_amount }}</p>
                        <p style="line-height: 28px">配送费: ￥{{ params.dispatch_amount }}</p>
                        <p style="line-height: 28px" v-if="params.score_fee>0">消费积分: {{ params.score_fee }}</p>
                        <p style="line-height: 28px">订单总金额: <span
                                class="order-msg-right-money">￥{{ params.pay_fee }}</span> (优惠: -￥{{ params.off_price
                            }})</p>
                    </div>
                </div>
            </td>
        </tr>
        <tr>
            <td>
                <div class="order-msg-center" style="padding:50px 0;">
                    <el-steps :active="stepActive" align-center finish-status="success">
                        <el-step title="买家下单" :description='params.created_at'>
                        </el-step>
                        <el-step title="买家付款"
                                 :description="params.status>0?moment(params.paytime*1000).format('YYYY-MM-DD HH:mm:ss'):''">
                        </el-step>
                        <el-step title="商家发货"
                                 :description='(params.ext_arr && params.ext_arr.send_time)?moment(params.ext_arr.send_time*1000).format("YYYY-MM-DD HH:mm:ss"):""'>
                        </el-step>
                        <el-step title="交易完成"
                                 :description="(params.ext_arr && params.ext_arr.finish_time)?moment(params.ext_arr.finish_time*1000).format('YYYY-MM-DD HH:mm:ss'):''">
                        </el-step>
                    </el-steps>
                </div>
                <div class="order-msg-center">
                    <el-row style="width: 100%;">
                        <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="tip-container">
                            <div class="order-detail-tip-title">温馨提示：</div>
                            <div class="flex-1"><span v-if="params.status==0"
                                                      class="color-999">请务必等待订单状态变更为“买家已付款，等待卖家发货”后再进行发货</span>
                                <span v-if="params.status==1"
                                      class="color-999">1、如果无法发货，请及时与买家联系并说明情况后进行退款；2、买家申请退款后，须征得买家同意后发货，否则买家有权拒收货物</span>
                                <span v-if="params.status==2" class="color-999">交易完成，若买家提出售后要求，请积极与买家协商。</span>
                                <span v-if="params.status==-1" class="color-999">买家已取消</span>
                                <span v-if="params.status==-2" class="color-999">买家未在规定时间内付款，交易自动关闭</span>
                            </div>
                        </el-col>
                        <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="tip-container">
                            <div class="order-detail-remark">买家留言：</div>
                            <div class="color-999 flex-1" v-if="params.remark">{{params.remark}}</div>
                            <div class="color-999 flex-1" v-if="!params.remark">无</div>
                        </el-col>
                    </el-row>
                </div>
            </td>
        </tr>

        <tr v-if="packageList.length>0"><td>
            <div class="package-con">
                <div class="package-log">
                    <el-tabs v-model="activeName" type="card">
                        <el-tab-pane v-for="(item,index) in packageList" :label="'包裹'+(index+1)" :name="index+1"></el-tab-pane>
                    </el-tabs>
                    <div class="log-btn display-flex">

                    </div>
                </div>

                <el-row style="overflow: auto;max-height: 400px;background: #fff;">
                    <el-col :span="10">
                        <div class="package-item">
                            <div><span>快递公司：</span><span>{{packageList[activeName-1].express_name}}</span></div>
                            <div class="package-item-time">
                                <span>快递单号：</span><span>{{packageList[activeName-1].express_no}}</span>
                            </div>
                            <div style="display: flex;flex-wrap: wrap;">
                                <div class="display-flex package-item-goods" v-for="it in packageList[activeName-1].item">
                                    <img class="table-img" :src="it.goods_image" style="height: 50px;">
                                    <div>
                                        <div class="goods-title package-item-goods-title goods-title-ellipsis color-999">
                                            {{it.goods_title}}</div>
                                        <div class="color-999"><span>数量：</span><span>{{it.goods_num}}</span>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </el-col>
                    <el-col :span="14">
                        <div class="package-item-delivery">
                            <div class="package-item-delivery-status"><span>物流状态:</span>
                                <span class="theme-color cursor-pointer"
                                      @click="editDeliverDialog(packageList[activeName-1].id)">修改物流</span>
                                <span class="theme-color cursor-pointer" style="padding-left: 25px;"
                                      @click="getExpress(packageList[activeName-1].id)">刷新物流</span>
                                <span class="theme-color cursor-pointer" style="padding-left: 25px;"
                                      @click="subExpress(packageList[activeName-1].id)">重新订阅</span>
                            </div>
                            <div style="padding-left: 10px;" class="steps-box">
                                <el-steps direction="vertical" :active="deliveryActive">
                                    <el-step v-for="i in packageList[activeName-1].log" :title="i.changedate"
                                             :description="i.content">
                                    </el-step>
                                </el-steps>
                            </div>
                        </div>
                    </el-col>
                </el-row>
            </div>
        </td></tr>

        <tr>
            <td>
                <div style="display: flex; justify-content: space-around; align-items: center;">
                    <div style="flex: 1">
                        <div style="font-size: 14px; font-weight: bolder;">收货信息
                            <span class="theme-color cursor-pointer" @click="consigneeEdit">修改</span>
                        </div>
                        <div style="justify-content: space-between; align-items: center; text-align: left;">
                            <p>收货人: {{ params.consignee }} {{ params.phone }}</p>
                            <p>省市区: {{ params.province_name }} {{ params.city_name }} {{ params.area_name }}</p>
                            <p>收货地址: {{ params.address }}</p>
                        </div>
                    </div>
                    <div style="flex: 1">
                        <div style="font-size: 14px; font-weight: bolder;">付款信息</div>
                        <div style="justify-content: space-between; align-items: center; text-align: left;">
                            <div>
                                <div class="display-flex delivery-msg-item-msg">
                                    <div class="title-span-width">实付金额: </div>
                                    <div class="delivery-margin-left">{{ params.pay_fee }}</div>
                                </div>
                                <div class="display-flex delivery-msg-item-msg">
                                    <div class="title-span-width">付款方式: </div>
                                    <div class="delivery-margin-left">{{ params.pay_type_text }}</div>
                                </div>
                                <div class="display-flex delivery-msg-item-msg">
                                    <div class="title-span-width">付款时间: </div>
                                    <div class="delivery-margin-left">{{ moment(params.paytime*1000).format("YYYY-MM-DD HH:mm:ss") }}</div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div style="flex: 1">
                        <div class="delivery-msg-item">
                            <div style="font-size: 14px; font-weight: bolder;">下单用户<span style="color: red;font-weight: normal;" v-if="params.customer_id>0">(代客下单)</span></div>
                            <div class="delivery-msg-item-msg" v-if="params.customer_id>0">
                                <div style="line-height: 25px;color: red">支付人ID：{{ params.member_id }}</div>
                                <div style="line-height: 25px;">下单人ID：{{ params.customer_id }}</div>
                                <div style="line-height: 25px;">{{ params.customer && params.customer.nickname }} - {{ params.customer && params.customer.phone }}</div>
                            </div>
                            <div class="display-flex delivery-msg-item-msg" v-else>
                                <img style="width: 54px; height: 54px; border-radius: 50%; margin-right: 20px;" :src="params.member && params.member.avatar">
                                <div>
                                    <div class="display-flex delivery-msg-item-msg">
                                        <div class="title-span-width">ID :</div>
                                        <div class="delivery-margin-left theme-color cursor-pointer"
                                             style="text-decoration: underline;">
                                            {{ params.member_id }}
                                        </div>
                                    </div>
                                    <div class="display-flex delivery-msg-item-msg">
                                        <div class="title-span-width">昵称:</div>
                                        <div class="delivery-margin-left">{{ params.member && params.member.nickname }}</div>
                                    </div>
                                    <div class="display-flex delivery-msg-item-msg">
                                        <div class="title-span-width">手机:</div>
                                        <div class="delivery-margin-left">{{ params.member && params.member.phone }}</div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </td>
        </tr>
        <tr>
            <td style="padding:0;">
                <div class="good-list" style="overflow-x: auto; width: 1000px">
                    <table cellspacing="0" cellpadding="0" border="0" class="el-table el-table__header" width="1700px">
                        <colgroup>
                            <col name="el-table_1_column_1" width="480">
                            <col name="el-table_1_column_2" width="120">
                            <col name="el-table_1_column_3" width="110">
                            <col name="el-table_1_column_4" width="120">
                            <col name="el-table_1_column_5" width="110">
                            <col name="el-table_1_column_6" width="110">
                            <col name="el-table_1_column_7" width="100">
                            <col name="el-table_1_column_8" width="100">
                            <col name="el-table_1_column_9" width="100">
                            <col name="el-table_1_column_10" width="100">
                            <col name="el-table_1_column_11" width="100">
                            <col name="el-table_1_column_12" width="100">
                            <col name="el-table_1_column_13" width="100">
                            <col name="el-table_1_column_14" width="100">
                        </colgroup>
                        <thead class="has-gutter">
                        <tr class="">
                            <th colspan="1" rowspan="1" class="el-table_1_column_1     is-leaf">
                                <div class="cell">商品</div>
                            </th>
                            <th colspan="1" rowspan="1" class="el-table_1_column_2     is-leaf">
                                <div class="cell">单价(元)</div>
                            </th>
                            <th colspan="1" rowspan="1" class="el-table_1_column_3     is-leaf">
                                <div class="cell">数量</div>
                            </th>
                            <th colspan="1" rowspan="1" class="el-table_1_column_5     is-leaf">
                                <div class="cell">小计(元)</div>
                            </th>
                            <th colspan="1" rowspan="1" class="el-table_1_column_6     is-leaf">
                                <div class="cell">订单类型</div>
                            </th>
                            <th colspan="1" rowspan="1" class="el-table_1_column_7     is-leaf">
                                <div class="cell">配送方式</div>
                            </th>
                            <th colspan="1" rowspan="1" class="el-table_1_column_8     is-leaf">
                                <div class="cell">发货状态</div>
                            </th>
                            <th colspan="1" rowspan="1" class="el-table_1_column_9     is-leaf">
                                <div class="cell">核销详情</div>
                            </th>
                            <th colspan="1" rowspan="1" class="el-table_1_column_10     is-leaf">
                                <div class="cell">退款状态</div>
                            </th>
                            <th colspan="1" rowspan="1" class="el-table_1_column_11     is-leaf">
                                <div class="cell">售后状态</div>
                            </th>
                            <th colspan="1" rowspan="1" class="el-table_1_column_12     is-leaf">
                                <div class="cell">所属门店</div>
                            </th>
                            <th colspan="1" rowspan="1" class="el-table_1_column_13     is-leaf">
                                <div class="cell">配送信息</div>
                            </th>
                            <th colspan="1" rowspan="1" class="el-table_1_column_14     is-leaf">
                                <div class="cell">评价状态</div>
                            </th>
                        </tr>
                        </thead>
                        <tbody>
                        <tr class="el-table__row" v-for="(vo,index) in params.item">
                            <td rowspan="1" colspan="1" class="el-table_1_column_1  ">
                                <div class="cell" style="justify-content: flex-start;">
                                    <div class="display-flex">
                                        <img :src="vo.goods_image" class="table-img" style="max-height: 70px; flex:1">
                                        <div style=" flex:5">
                                            <div class="goods-title goods-title-ellipsis"><p>
                                                {{ vo.goods_title }} </p></div>
                                            <div class="color-999" v-if="vo.goods_sku_text"><span>规格：{{ vo.goods_sku_text }}</span></div>
                                        </div>
                                    </div>
                                </div>
                            </td>
                            <td rowspan="1" colspan="1" class="el-table_1_column_2  ">
                                <div class="cell"><span class="color-666">￥{{ vo.goods_price }}</span></div>
                            </td>
                            <td rowspan="1" colspan="1" class="el-table_1_column_3  ">
                                <div class="cell"><span class="color-666">{{ vo.goods_num }}</span></div>
                            </td>
                            <td rowspan="1" colspan="1" class="el-table_1_column_5  ">
                                <div class="cell">
                                    <div v-if="params.type=='score'">
                                        <div class="color-666">￥{{(vo.goods_price * vo.goods_num).toFixed(2)}}</div>
                                        <div class="color-666">
                                            <span>+{{params.score_amount}}积分</span>
                                        </div>
                                    </div>
                                    <div v-else>
                                        <div class="color-666" v-if="vo.discount_fee>0">
                                            ￥{{(vo.goods_price * vo.goods_num - vo.discount_fee).toFixed(2)}}
                                            <p>
                                            <del v-if="vo.discount_fee">
                                                ￥{{(vo.goods_price * vo.goods_num).toFixed(2)}}
                                            </del>
                                            </p>
                                        </div>
                                        <div class="color-666" v-else>
                                            ￥{{(vo.goods_price * vo.goods_num).toFixed(2)}}
                                        </div>
                                    </div>
                                </div>
                            </td>
                            <td rowspan="1" colspan="1" class="el-table_1_column_6  ">
                                <div class="cell"><span class="color-666">{{ params.type | type }}</span></div>
                            </td>
                            <td rowspan="1" colspan="1" class="el-table_1_column_7  ">
                                <div class="cell"><span class="color-666">{{ vo.dispatch_type | dispatchType }}</span></div>
                            </td>
                            <td rowspan="1" colspan="1" class="el-table_1_column_8  ">
                                <div class="cell">
                                    <span class="color-666" v-if="params.status>0">
                                        <span v-if="vo.dispatch_type=='express'">{{vo.dispatch_status | dispatch}}</span>
                                        <span v-else>{{ vo.status }}</span>
                                    </span>
                                    <span class="color-666" v-else>-</span>
                                </div>
                            </td>
                            <td rowspan="1" colspan="1" class="el-table_1_column_9  ">
                                <div class="cell">
                                    <span v-if="vo.verifies && vo.verifies.length>0" class="theme-color cursor-pointer"
                                          @click="openVerifiesDialog(vo)">
                                        查看
                                    </span>
                                    <span v-else class="color-666">-</span>
                                </div>
                            </td>
                            <td rowspan="1" colspan="1" class="el-table_1_column_10  ">
                                <div class="cell">
                                    <div class="color-666 common-btn-box" v-if="params.status>0">
                                        <span class="theme-color cursor-pointer"
                                          v-if="vo.abtns && vo.abtns.indexOf('refund')!=-1"
                                          @click="openRefundDialog(params, vo)">主动退款</span>
                                        <span v-else>{{ vo.refund_status | refund }}</span>
                                    </div>
                                    <div class="color-666" v-else>-</div>
                                </div>
                            </td>
                            <td rowspan="1" colspan="1" class="el-table_1_column_11  ">
                                <div class="cell">
                                    <div class="color-666 common-btn-box" v-if="params.status>0">
                                        <span class="theme-color cursor-pointer"
                                          v-if="vo.abtns && vo.abtns.indexOf('aftersale_info')!=-1"
                                          @click="goAftersale(vo.ext_arr.aftersale_id)">售后详情</span>
                                        <span v-else>{{ vo.aftersale_status | aftersale }}</span>
                                    </div>
                                    <div class="color-666" v-else>-</div>
                                </div>
                            </td>
                            <td rowspan="1" colspan="1" class="el-table_1_column_12  ">
                                <div class="cell">
                                    <div class="color-666 common-btn-box" v-if="params.status>0">
                                        <span v-if="vo.dispatch_type=='store' || vo.dispatch_type=='selfetch'">{{vo.store.name}}</span>
                                        <span v-else>-</span>
                                    </div>
                                    <div class="color-666" v-else>-</div>
                                </div>
                            </td>
                            <td rowspan="1" colspan="1" class="el-table_1_column_13  ">
                                <div class="cell">
                                    <div class="color-666 common-btn-box" v-if="params.status>0">
                                        <el-popover placement="bottom" trigger="click" width="220">
                                            <div class="popover-container"
                                                 v-if="vo.dispatch_type=='store' || vo.dispatch_type=='selfetch'">
                                                <div class="display-flex">
                                                    <div class="popover-tip">手机号：</div>
                                                    <div v-if="vo.ext_arr.dispatch_phone">{{vo.ext_arr.dispatch_phone}}
                                                    </div>
                                                    <div v-if="!vo.ext_arr.dispatch_phone">-</div>
                                                </div>
                                                <div class="display-flex">
                                                    <div class="popover-tip">日期：</div>
                                                    <div v-if="vo.ext_arr.dispatch_date">{{vo.ext_arr.dispatch_date}}
                                                    </div>
                                                    <div v-if="!vo.ext_arr.dispatch_date">-</div>
                                                </div>
                                            </div>
                                            <div class="popover-container" v-if="vo.dispatch_type=='autosend'">
                                                <div>
                                                    <span class="popover-tip">发货内容：</span>
                                                    <span v-if="vo.ext_arr.autosend_content">
                                                        <template v-if="vo.ext_arr.autosend_type=='text'">
                                                            {{vo.ext_arr.autosend_content}}
                                                        </template>
                                                        <template v-if="vo.ext_arr.autosend_type=='params'"
                                                                  v-for="it in vo.ext_arr.autosend_content">
                                                            {{it.name}}-{{it.value}}
                                                        </template>
                                                    </span>
                                                    <div v-if="!vo.ext_arr.autosend_content">-</div>
                                                </div>
                                            </div>
                                            <div class="ellipsis-item cursor-pointer theme-color" slot="reference" v-if="vo.dispatch_type!='express'">
                                                查看详情
                                            </div>
                                        </el-popover>
                                        <div v-if="vo.dispatch_type=='express'">-</div>
                                    </div>
                                    <div class="color-666" v-else>-</div>
                                </div>
                            </td>
                            <td rowspan="1" colspan="1" class="el-table_1_column_14  ">
                                <div class="cell">
                                    <div class="color-666 common-btn-box" v-if="params.status>0">
                                        <span v-if="vo.comment_status==0">{{vo.comment_status | comment}}</span>
                                        <div class="theme-color cursor-pointer" v-if="vo.comment_status>=1"
                                             @click="goComment(vo.id)">查看评价
                                        </div>
                                    </div>
                                    <div class="color-666" v-else>-</div>
                                </div>
                            </td>
                        </tr>
                        </tbody>
                    </table>
                </div>
            </td>
        </tr>
    </table>
</form>

<script>
    var ordereditVm = new Vue({
        el: '#<?php echo $uniqid;?>',
        data: {
            params: JSON.parse('<?php echo addslashes($dataset);?>'),
            packageList:JSON.parse('<?php echo addslashes($packageList);?>'),
            stepActive: 1,
            activeName: 1,
            deliveryActive: 1,
            express_dialog: false,
        },
        filters: {
            dispatch(value) {
                // 0=未发货,1=已发货,2=已收货
                switch (parseInt(value)) {
                    case 0:
                        return '未发货';
                    case 1:
                        return '已发货';
                    case 2:
                        return '已收货';
                }
            },
            comment(value) {
                // 0=未评价,1=已评价
                switch (parseInt(value)) {
                    case 0:
                        return '未评价';
                    case 1:
                        return '已评价';
                }
            },
            aftersale(value) {
                // -1=拒绝,0=未申请,1=申请售后,2=售后完成
                switch (parseInt(value)) {
                    case -1:
                        return '拒绝';
                    case 0:
                        return '未申请';
                    case 1:
                        return '申请售后';
                    case 2:
                        return '售后完成';
                }
            },
            refund(value) {
                // -1=拒绝退款,0=无,1=申请中,2=同意
                switch (parseInt(value)) {
                    case -1:
                        return '拒绝退款';
                    case 0:
                        return '无';
                    case 1:
                        return '申请中';
                    case 2:
                        return '同意';
                    case 3:
                        return '退款完成';
                }
            },
            dispatchType(value){
                // express=物流快递,selfetch=用户自提,store=商户配送,autosend=自动发货
                switch (value) {
                    case 'express':
                        return '物流快递';
                    case 'selfetch':
                        return '用户自提';
                    case 'store':
                        return '商户配送';
                    case 'autosend':
                        return '自动发货';
                }
            },
            platform(value){
                // H5=H5,wxOfficialAccount=微信公众号,wxMiniProgram=微信小程序,App=App
                switch (value) {
                    case 'H5':
                    case 'App':
                        return value;
                    case 'wxOfficialAccount':
                        return '微信公众号';
                    case 'wxMiniProgram':
                        return '微信小程序';
                }
            },
            type(value){
                switch (value) {
                    case 'goods':
                        return '商城订单';
                    case 'score':
                        return '积分订单';
                }
            },
            payType(value){
                // wechat=微信支付,alipay=支付宝,wallet=钱包支付,score=积分支付
                switch (value) {
                    case 'wechat':
                        return '微信支付';
                    case 'alipay':
                        return '支付宝';
                    case 'wallet':
                        return '钱包支付';
                    case 'score':
                        return '积分支付';
                    case 'JoinPay-wx':
                        return '汇聚支付-微信';
                    case 'JoinPay-ali':
                        return '汇聚支付-支付宝';
                    case 'pickgoods':
                        return '提货卡';
                    default:
                        return '未支付';
                }
            },
            formatDate(nS){
                return new Date(parseInt(nS) * 1000).toLocaleString().replace(/:\d{1,2}$/,' ');
            }
        },
        methods: {
            init() {
                this.changeSteps();
            },
            openDeliverDialog() {
                $("#orderdeliverydlg").dialog({
                    title: '订单发货',
                    closed: false,
                    width: 740,
                    height: 520,
                    cache: false,
                    href: '/admin/order/delivery?order_id=' + this.params.id,
                    modal: true,
                    buttons: [{
                        text: '立即发货',
                        id: 'orderdeliverysubmit',
                        iconCls: 'icon-ok',
                    }, {
                        text: '关闭',
                        iconCls: 'icon-no',
                        handler: function () {
                            $("#orderdeliverydlg").dialog('close');
                        }
                    }]
                });
            },
            editDeliverDialog(express_id) {
                $("#orderdeliverydlg").dialog({
                    title: '更新发货单',
                    closed: false,
                    width: 740,
                    height: 520,
                    cache: false,
                    href: '/admin/order/delivery?express_id=' + express_id,
                    modal: true,
                    buttons: [{
                        text: '立即发货',
                        id: 'orderdeliverysubmit',
                        iconCls: 'icon-ok',
                    }, {
                        text: '关闭',
                        iconCls: 'icon-no',
                        handler: function () {
                            $("#orderdeliverydlg").dialog('close');
                        }
                    }]
                });
            },
            getExpress(express_id) {
                $.post('/admin/order/getExpress', {express_id: express_id}, function (data) {
                    if (data.ret === 0) {
                        console.log(data);
                        ordereditVm.packageList = data.data;
                    } else {
                        $.messager.alert('提示', data.msg, 'warning');
                    }
                }, 'json');
            },
            subExpress(express_id) {
                $.post('/admin/order/subExpress', {express_id: express_id}, function (data) {
                    if (data.ret === 0) {
                        $.messager.show({
                            title: '提示',
                            msg: data.msg,
                            timeout: 3000,
                            showType: 'slide'
                        });
                    } else {
                        $.messager.alert('提示', data.msg, 'warning');
                    }
                }, 'json');
            },
            openSendStoreDialog() {},
            openRefundDialog(order, order_item) {
                let refund_money = 0.00;
                let param = {};
                if(order_item){
                    refund_money = order_item.pay_price;
                    param = {order_id: order.id, order_item_id: order_item.id, money: 0}
                }else{
                    let refunded = 0.00;
                    this.params.item.forEach(it=>{
                        if(it.refund_status>1){
                            refunded += it.pay_price;
                        }
                    });
                    refund_money = (parseFloat(order.pay_fee) - refunded).toFixed(2);
                    param = {order_id: order.id, money: 0}
                }
                $.messager.prompt('退款处理', '请输入退款金额:(最多可退'+refund_money+')', function(r){
                    if (r){
                        let money = parseFloat(r);
                        if(money>refund_money){
                            $.messager.alert('提示', '最多可退: '+refund_money+'元', 'warning');
                            return;
                        }
                        if(money<0){
                            $.messager.alert('提示', '请输入正常的退款金额', 'warning');
                            return;
                        }
                        param.money = money;
                        $.post('/admin/order/refund', param, function (data) {
                            if (data.ret === 0) {
                                $.messager.show({
                                    title: '提示',
                                    msg: data.msg,
                                    timeout: 3000,
                                    showType: 'slide'
                                });
                                if(orderVm) { orderVm.init(); }
                                $('#rightTabs').tabs('close','查看订单');
                            } else {
                                $.messager.alert('提示', data.msg, 'warning');
                            }
                        }, 'json');
                    }
                });
            },
            changeSteps() {
                let status_code = ordereditVm.params.status_code;
                let status = parseInt(ordereditVm.params.status);
                if (status === 0) {
                    ordereditVm.stepActive = 1
                } else if (status === 1) {
                    ordereditVm.stepActive = 2;
                    switch (status_code) {
                        case 'nosend':
                            ordereditVm.stepActive = 2
                            break;
                        case 'noget':
                            ordereditVm.stepActive = 3
                            break;
                        case 'nocomment':
                            ordereditVm.stepActive = 4
                            break;
                        case 'commented':
                            ordereditVm.stepActive = 4
                            break;
                    }
                } else if (status === 2) {
                    ordereditVm.stepActive = 4;
                }
            },
            addMemo() {
                $("#orderdeliverydlg").dialog({
                    title: '商家备注',
                    closed: false,
                    width: 540,
                    height: 330,
                    cache: false,
                    href: '/admin/order/memo?order_id=' + this.params.id,
                    modal: true,
                    buttons: [{
                        text: '确定',
                        id: 'memosubmit',
                        iconCls: 'icon-ok',
                    }, {
                        text: '关闭',
                        iconCls: 'icon-no',
                        handler: function () {
                            $("#orderdeliverydlg").dialog('close');
                        }
                    }]
                });
            },
            consigneeEdit(){
                $("#orderdeliverydlg").dialog({
                    title: '收货信息修改',
                    closed: false,
                    width: 740,
                    height: 520,
                    cache: false,
                    href: '/admin/order/consignee?order_id=' + this.params.id,
                    modal: true,
                    buttons: [{
                        text: '确定',
                        id: 'orderdeliverysubmit',
                        iconCls: 'icon-ok',
                    }, {
                        text: '关闭',
                        iconCls: 'icon-no',
                        handler: function () {
                            $("#orderdeliverydlg").dialog('close');
                        }
                    }]
                });
            }
        }
    });
    $(function () {
        ordereditVm.init();
        $('#<?php echo $uniqid;?> .good-list').width($(window).width() - $("#leftMenu").width() - 230);
        $('#ordersubmit').click(function (data) {
            ordereditVm.submit();
        });
    });
</script>

<style>
    .tip-container {
        display: flex;
        margin-bottom: 10px;
    }
    .order-main-btn {
        margin-right: 20px;
        width: 88px;
        text-align: center;
        height: 30px;
        line-height: 30px;
        color: #fff;
        border-radius: 4px;
        background: #753ECD;
        cursor: pointer;
    }
    .order-detail-tip-title {
        color: #FFB333;
    }
    .order-detail-remark {
        color: #7438D5;
    }
    .all-refund-money-text {
        color: #FF5959;
        cursor: pointer;
    }

    .order-msg-right-money {
        font-size: 20px;
        color: #FF5000;
    }

    .order-msg-center {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 100%;
    }

    .order-msg-center .el-steps.el-steps--horizontal {
        width: 84%;
    }

    .el-steps {
        display: -webkit-box;
        display: -ms-flexbox;
        display: flex;
    }

    .el-steps--simple {
        padding: 13px 8%;
        border-radius: 4px;
        background: #f5f7fa;
    }

    .el-steps--horizontal {
        white-space: nowrap;
    }

    .el-steps--vertical {
        height: 100%;
        -webkit-box-orient: vertical;
        -webkit-box-direction: normal;
        -ms-flex-flow: column;
        flex-flow: column;
    }

    .el-step {
        position: relative;
        -ms-flex-negative: 1;
        flex-shrink: 1;
    }

    .el-step:last-of-type .el-step__line {
        display: none;
    }

    .el-step:last-of-type.is-flex {
        -ms-flex-preferred-size: auto !important;
        flex-basis: auto !important;
        -ms-flex-negative: 0;
        flex-shrink: 0;
        -webkit-box-flex: 0;
        -ms-flex-positive: 0;
        flex-grow: 0;
    }

    .el-step:last-of-type .el-step__description,
    .el-step:last-of-type .el-step__main {
        padding-right: 0;
    }

    .el-step__head {
        position: relative;
        width: 100%;
    }

    .el-step__head.is-process {
        color: #303133;
        border-color: #303133;
    }

    .el-step__head.is-wait {
        color: #c0c4cc;
        border-color: #c0c4cc;
    }

    .el-step__head.is-success {
        color: #67c23a;
        border-color: #67c23a;
    }

    .el-step__head.is-error {
        color: #f56c6c;
        border-color: #f56c6c;
    }

    .el-step__head.is-finish {
        color: #7438d5;
        border-color: #7438d5;
    }

    .el-step__icon {
        position: relative;
        z-index: 1;
        display: -ms-inline-flexbox;
        display: inline-flex;
        -webkit-box-pack: center;
        -ms-flex-pack: center;
        justify-content: center;
        -webkit-box-align: center;
        -ms-flex-align: center;
        align-items: center;
        width: 24px;
        height: 24px;
        font-size: 14px;
        -webkit-box-sizing: border-box;
        box-sizing: border-box;
        background: #fff;
        -webkit-transition: 0.15s ease-out;
        transition: 0.15s ease-out;
    }

    .el-step__icon.is-text {
        color: #fff;
        border-radius: 50%;
        border: 2px solid;
        border-color: inherit;
    }

    .el-step__icon.is-icon {
        width: 40px;
    }

    .el-step__icon-inner {
        display: inline-block;
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
        text-align: center;
        font-weight: 700;
        line-height: 1;
        color: inherit;
    }

    .el-step__icon-inner[class*="el-icon"]:not(.is-status) {
        font-size: 25px;
        font-weight: 400;
    }

    .el-step__icon-inner.is-status {
        -webkit-transform: translateY(1px);
        transform: translateY(1px);
    }

    .el-step__line {
        position: absolute;
        border-color: inherit;
        background-color: #c0c4cc;
    }

    .el-step__line-inner {
        display: block;
        border-width: 1px;
        border-style: solid;
        border-color: inherit;
        -webkit-transition: 0.15s ease-out;
        transition: 0.15s ease-out;
        -webkit-box-sizing: border-box;
        box-sizing: border-box;
        width: 0;
        height: 0;
    }

    .el-step__main {
        white-space: normal;
        text-align: left;
    }

    .el-step__title {
        font-size: 16px;
        line-height: 38px;
    }

    .el-step__title.is-process {
        font-weight: 500;
        color: #303133;
    }

    .el-step__title.is-wait {
        color: #c0c4cc;
    }

    .el-step__title.is-success {
        color: #444;
    }

    .el-step__title.is-error {
        color: #f56c6c;
    }

    .el-step__title.is-finish {
        color: #7438d5;
    }

    .el-step__description {
        padding-right: 10%;
        margin-top: -5px;
        font-size: 12px;
        line-height: 20px;
        font-weight: 400;
    }

    .el-step__description.is-process {
        color: #303133;
    }

    .el-step__description.is-wait {
        color: #c0c4cc;
    }

    .el-step__description.is-success {
        color: #999;
    }

    .el-step__description.is-error {
        color: #f56c6c;
    }

    .el-step__description.is-finish {
        color: #7438d5;
    }

    .el-step.is-horizontal {
        display: inline-block;
    }

    .el-step.is-horizontal .el-step__line {
        height: 1px;
        top: 11px;
        left: 0;
        right: 0;
    }

    .el-step.is-vertical {
        display: -webkit-box;
        display: -ms-flexbox;
        display: flex;
    }

    .el-step.is-vertical .el-step__head {
        -webkit-box-flex: 0;
        -ms-flex-positive: 0;
        flex-grow: 0;
        width: 24px;
    }

    .el-step.is-vertical .el-step__main {
        padding-left: 10px;
        -webkit-box-flex: 1;
        -ms-flex-positive: 1;
        flex-grow: 1;
    }

    .el-step.is-vertical .el-step__title {
        line-height: 24px;
        padding-bottom: 8px;
    }

    .el-step.is-vertical .el-step__line {
        width: 2px;
        top: 0;
        bottom: 0;
        left: 11px;
    }

    .el-step.is-vertical .el-step__icon.is-icon {
        width: 24px;
    }

    .el-step.is-center .el-step__head {
        text-align: center;
    }

    .el-step.is-center .el-step__main {
        text-align: center;
    }

    .el-step.is-center .el-step__description {
        padding-left: 20%;
        padding-right: 20%;
    }

    .el-step.is-center .el-step__line {
        left: 50%;
        right: -50%;
    }

    .el-step.is-simple {
        display: -webkit-box;
        display: -ms-flexbox;
        display: flex;
        -webkit-box-align: center;
        -ms-flex-align: center;
        align-items: center;
    }

    .el-step.is-simple .el-step__head {
        width: auto;
        font-size: 0;
        padding-right: 10px;
    }

    .el-step.is-simple .el-step__icon {
        background: 0 0;
        width: 16px;
        height: 16px;
        font-size: 12px;
    }

    .el-step.is-simple .el-step__icon-inner[class*="el-icon"]:not(.is-status) {
        font-size: 18px;
    }

    .el-step.is-simple .el-step__icon-inner.is-status {
        -webkit-transform: scale(0.8) translateY(1px);
        transform: scale(0.8) translateY(1px);
    }

    .el-step.is-simple .el-step__main {
        position: relative;
        display: -webkit-box;
        display: -ms-flexbox;
        display: flex;
        -webkit-box-align: stretch;
        -ms-flex-align: stretch;
        align-items: stretch;
        -webkit-box-flex: 1;
        -ms-flex-positive: 1;
        flex-grow: 1;
    }

    .el-step.is-simple .el-step__title {
        font-size: 16px;
        line-height: 20px;
    }

    .el-step.is-simple:not(:last-of-type) .el-step__title {
        max-width: 50%;
        word-break: break-all;
    }

    .el-step.is-simple .el-step__arrow {
        -webkit-box-flex: 1;
        -ms-flex-positive: 1;
        flex-grow: 1;
        display: -webkit-box;
        display: -ms-flexbox;
        display: flex;
        -webkit-box-align: center;
        -ms-flex-align: center;
        align-items: center;
        -webkit-box-pack: center;
        -ms-flex-pack: center;
        justify-content: center;
    }

    .el-step.is-simple .el-step__arrow::after,
    .el-step.is-simple .el-step__arrow::before {
        content: "";
        display: inline-block;
        position: absolute;
        height: 15px;
        width: 1px;
        background: #c0c4cc;
    }

    .el-step.is-simple .el-step__arrow::before {
        -webkit-transform: rotate(-45deg) translateY(-4px);
        transform: rotate(-45deg) translateY(-4px);
        -webkit-transform-origin: 0 0;
        transform-origin: 0 0;
    }

    .el-step.is-simple .el-step__arrow::after {
        -webkit-transform: rotate(45deg) translateY(4px);
        transform: rotate(45deg) translateY(4px);
        -webkit-transform-origin: 100% 100%;
        transform-origin: 100% 100%;
    }

    .el-step.is-simple:last-of-type .el-step__arrow {
        display: none;
    }

    .el-step.is-center .el-step__head {
        text-align: center;
    }

    .el-step__head.is-success {
        color: #7536D0;
        border-color: #7536D0;
    }

    .el-step__head {
        position: relative;
        width: 100%;
    }

    .el-step__head.is-success .el-step__icon.is-text {
        background: #7536D0;
    }

    .el-step__icon.is-text {
        background: #eee;
        border: 4px solid #fff;
    }

    .el-step__icon.is-text {
        border-radius: 50%;
    }

    .el-step__icon {
        width: 38px;
        height: 38px;
    }

    .el-step.is-horizontal .el-step__line {
        top: 18px;
    }

    .el-table th .cell, .el-table td .cell {
        display: flex;
        align-items: center;
        justify-content: flex-start;
    }

    .el-table th.is-leaf {
        border-bottom: none;
    }

    .el-table td, .el-table th, .el-table th.is-leaf {
        border-color: #f7f7f7;
    }

    .el-table th {
        font-size: 13px;
    }

    .el-table th {
        background: #F9F9F9;
    }

    .el-table th {
        padding: 7px 0;
    }

    .el-table, .el-table thead, .el-table th {
        color: #444;
        font-weight: 500;
    }
    .cursor-pointer {
        cursor: pointer;
    }
    .theme-color {
        color: #7536D0;
    }
    .copy-msg {
        color: #70C140;
    }

    .steps-box .el-step{}
    .el-step__icon.is-text {
        border-radius: 50%;
        width: 30px;
        height: 30px;
    }
    .el-step.is-vertical .el-step__line {
        width: 2px;
        top: 0;
        bottom: 0;
        left: 14px;
    }

    .el-step.is-vertical .el-step__title {
        line-height: 24px;
        padding-bottom: 8px;
        font-size:12px
    }

    .el-step.is-vertical .el-step__main {
        padding-left: 10px;
        -webkit-box-flex: 1;
        -ms-flex-positive: 1;
        flex-grow: 1;
        padding: 5px 10px;
    }
</style>
